package com.wyg.epgateway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @Author: WangYongGan
 * @Date: 2022/5/15 12:31
 * @Description:
 */
@Configuration
public class FilterConfig {
    @Bean
    public RouteLocator customerRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route(
                        r -> r.path("/t/**")
                                .filters(f -> f.filter(new TestGatewayFilter()))
                                .uri("http://localhots:7001"))
                .build();
    }
}
